It Compiles

and that's pretty much all it does

It doesn't actually do anything, but it compiles and runs.

void main()

In this example, the main function doesn't do anything. In a useful program, statements are included between the braces ("{" and "}") the carry out the intent of the program. Since there are no statements in this main function, this program only has use as a demonstration.

Every program requires an entry point to describe which statements are executed at the beginning of the program. The main function is the typical entry point for a D console-mode program. A Windows GUI program would probably use a WinMain function, but GUI programs can get quite complicated in a hurry, so those discussions can wait for another day.

Return to Tutorial Overview